package com.pureut.system.api;

import com.pureut.common.core.constant.ServiceNameConstants;
import com.pureut.common.core.web.domain.AjaxResult;
import com.pureut.system.api.domain.SysTheAlarmDto;
import com.pureut.system.api.domain.SysWorkbenchMessage;
import com.pureut.system.api.factory.RemoteSystemFallbackFactory;
import com.pureut.system.api.vo.SysAuditHistoryVo;
import com.pureut.system.api.vo.SysWorkbenchAuditAgentVo;
import com.pureut.system.api.vo.SysWorkbenchMessageVo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;


/**
 * @author yiBao
 */
@FeignClient(contextId = "feignService", value = ServiceNameConstants.SYSTEM_SERVICE, fallbackFactory = RemoteSystemFallbackFactory.class)
public interface FeignService {

    /**
     * 根据物料id获取成品详细信息
     */
    @GetMapping(value = "/finished/{materialId}")
    public AjaxResult getInfo(@PathVariable("materialId") long materialId);

    /**
     * 根据物料id获取半成品详细信息
     */
    @GetMapping(value = "/half/{materialId}")
    public AjaxResult getHalfInfo(@PathVariable("materialId") long materialId);

    /**
     * 获取单个原料信息
     *
     * @param materialId
     * @return
     */
    @GetMapping(value = "/awmateria/{materialId}")
    public AjaxResult getAwmateriaInfo(@PathVariable("materialId") long materialId);

    /**
     * 获取单个辅料信息
     *
     * @param materialId
     * @return
     */
    @GetMapping(value = "/accessories/{materialId}")
    public AjaxResult getAccessoriesInfo(@PathVariable("materialId") long materialId);

    /**
     * 根据编号获取废料详细信息
     */
    @GetMapping(value = "/waste/{materialId}")
    public AjaxResult getWasteInfo(@PathVariable("materialId") long materialId);

    /**
     * 根据userId获取用户名称
     *
     * @param userId
     * @return
     */
    @GetMapping("/user/getUserName/{userId}")
    public String getUserName(@PathVariable("userId") Long userId);

    /**
     * 获取最大流水号
     */
    @GetMapping("/split/splitList")
    public String splitList(@RequestParam("str1") String str1) throws Exception;

    /**
     * 根据部门编号获取详细信息
     */
    @GetMapping(value = "/dept/{deptId}")
    public AjaxResult getDeptInfo(@PathVariable("deptId") Long deptId);

    /**
     * 根据字典类型和字典键值查询字典数据信息
     *
     * @param dictType  字典类型
     * @param dictLable 字典键值
     * @return 字典标签
     */
    @GetMapping("/getValue")
    public int getValue(@PathVariable("dictType") String dictType, @PathVariable("dictLable") String dictLable);

    /**
     * 根据用户id查询角色
     */
    @GetMapping("/roleByUserId")
    public AjaxResult roleByUserId(Long userId);

    /**
     * 根据按钮id返回审核信息
     */
    @GetMapping("/appconfig/sequence")
    public AjaxResult getSequenceTwo(@RequestParam("perms") String perms,
                                     @RequestParam("moduleType") int moduleType,
                                     @RequestParam("auditState") int auditState,
                                     @RequestParam("auditRemarks") String auditRemarks,
                                     @RequestParam("auditDoc") String auditDoc,
                                     @RequestParam("userId") long userId);

    /**
     * 修改审核类型
     */
    @PutMapping("/appconfig/editHistory")
    public AjaxResult editHistory(@RequestBody SysAuditHistoryVo sysAuditHistoryVo);

    /**
     * 根据物料id获取明细信息
     */
    @GetMapping("/material-bom-detail/getDosage")
    public AjaxResult getDosageByMaterialId(@RequestParam("bomId") Long bomId, @RequestParam("bomDetailType") int bomDetailType);

    /**
     * 根据菜单名称查询id
     */
    @GetMapping("/menu/getIdByMenuName")
    public Long getIdByMenuName(@RequestParam("menuName") String menuName);

    /**
     * 根据线别id获取详细信息
     */
    @GetMapping(value = "/modeling/{modelingId}")
    public AjaxResult getModelingInfo(@PathVariable("modelingId") long modelingId);

    /**
     * 根据权限码获取生成编码
     */
    @GetMapping(value = "/document/authorityCoding")
    public String getAuthorityCoding(@RequestParam("docConfig") String docConfig);


    /**
     * 根据车间id获取线别
     */
    @GetMapping("/modeling/getModelingLineInfo/{lineCode}")
    public AjaxResult getModelingLineInfo(@PathVariable("lineCode") String lineCode);


    /**
     * 根据线别编码获取车间id(fegin调用)
     */
    @GetMapping("/modeling/getWorkshopId")
    public AjaxResult getWorkshopId(@RequestParam("lineCode") String lineCode);

    /**
     * 通过模板类型查对应的模板列表
     */
    @GetMapping("/printConfig/typeList")
    public AjaxResult typeList(@RequestParam("type") int type);

    /**
     * 通过物料编码查询bom明细
     */
    @GetMapping("/bom/detailComposition")
    public AjaxResult detailComposition(@RequestParam("materialCode") String materialCode);

    /**
     * 通过物料编码查询bom明细
     */
    @GetMapping("/awmateria/selectCodingId")
    public AjaxResult selectCodingId(@RequestParam("materialCode") String materialCode);

    /**
     * 通过设备编码查出设备名称,设备类型,设备属性
     */
    @GetMapping("/drvice/getDrviceInfo")
    public AjaxResult getDrviceInfo(@RequestParam("drviceCode") String drviceCode);

    /**
     * 根据原料类别查询类别名称
     */
    @GetMapping("/awmateria/selectCodingRulesById")
    public AjaxResult selectCodingRulesById(@RequestParam("codingId") String codingId);

    /**
     * 根据ids获取名称(fegin调用)
     */
    @GetMapping("/user/getUserNameByIds")
    public AjaxResult getUserNameByIds(@RequestParam("userIds") String userIds);

    /**
     * 根据原料类别查询类别名称
     */
    @GetMapping("/materialCoding/selectMaterialCodingList")
    public AjaxResult selectMaterialCodingList();

    /**
     * 根据线别编码获取id
     */
    @GetMapping("/modeling/getLineId")
    public Long getLineId(@RequestParam("lineCode") String lineCode);

    /**
     * 根据编码获取半成品bom信息(fegin调用)
     */
    @GetMapping("/bom/getHalfData")
    public AjaxResult getHalfData(@RequestParam("materialCode") String materialCode);

    /**
     * 根据物料编码查询详情(原料信息)
     */
    @GetMapping("/awmateria/selectAllByAlarmMaterialCode")
    public AjaxResult selectAllByAlarmMaterialCode(@RequestParam("materialCode") String materialCode);

    /**
     * 根据物料编码查询详情(辅料信息)
     */
    @GetMapping("/accessories/selectAccessoriesMaterialCode")
    public AjaxResult selectAccessoriesMaterialCode(@RequestParam("materialCode") String materialCode);

    /**
     * 根据物料编码查询详情(半成品信息)
     */
    @GetMapping("/half/selectMaterialHalfMaterialCode")
    public AjaxResult selectMaterialHalfMaterialCode(@RequestParam("materialCode") String materialCode);

    /**
     * 根据物料编码查询详情(成品信息)
     */
    @GetMapping("/finished/selectMaterialFinishedMaterialCode")
    public AjaxResult selectMaterialFinishedMaterialCode(@RequestParam("materialCode") String materialCode);


    /**
     * 根据线别编码获取车间编码(fegin调用)
     */
    @GetMapping("/modeling/getWorkshopCode")
    public String getWorkshopCode(@RequestParam("lineCode") String lineCode);

    /**
     * 根据物料编码获取详情（委外订单详情列表调用 fegin，原料信息）
     */
    @GetMapping("/awmateria/getAwmateriaViewByMaterialCode")
    public AjaxResult getAwmateriaViewByMaterialCode(@RequestParam("materialCode") String materialCode);

    /**
     * 根据物料编码查询详情(委外订单明细列表fegin调用,半成品信息)
     */
    @GetMapping("/half/getHalfViewByMaterialCode")
    public AjaxResult getHalfViewByMaterialCode(@RequestParam("materialCode") String materialCode);

    /**
     * 根据编码获取半成品bom信息(fegin调用)
     */
    @GetMapping("/newBom/getHalfBomDetailData")
    public AjaxResult getHalfBomDetailData(@RequestParam("materialCode") String materialCode);

    @GetMapping("/modeling/getStorage")
    public Long getStorage(@RequestParam("lineCode") String lineCode);

    @GetMapping("/user/getByUserName")
    public AjaxResult getByUserName(@RequestParam("userName") String userName);

    /**
     * Feign---查询告警信息
     */
    @GetMapping("/awmateria/getAlarm")
    public SysTheAlarmDto getAlarm(@RequestParam("materialCode") String materialCode,@RequestParam("type") String type);

    /**
     * 获取BOM信息(库存量)
     */
    @GetMapping("/newBom/detailInventory")
    public AjaxResult listDetailInventory(@RequestParam("bomId") long bomId);

    /**
     * feign----新增消息提醒表
     */
    @PostMapping("/workbench-message/insertWork")
    public AjaxResult insertWork(@RequestBody List<SysWorkbenchMessageVo> list);

    /**
     * 查询最近一次库存量和物料编码的数据
     */
    @GetMapping("/workbench-message/getInfo")
    public List<SysWorkbenchMessage> getInfo(@RequestParam("type") String type);

    /**
     * 批量新增审核待办
     */
    @PostMapping("/sys-workbench-audit-agent/insertAuditAgent")
    public boolean insertAuditAgent(@RequestBody SysWorkbenchAuditAgentVo sysWorkbenchAuditAgentVo);

    /**
     * 修改审核代办状态
     */
    @PutMapping("/sys-workbench-audit-agent/updateStatus")
    public boolean updateStatus(@RequestParam("status") int status,@RequestParam("receiptNumber") String receiptNumber,@RequestParam("modelName") String modelName);

    /**
     * 删除审核代办
     */
    @DeleteMapping("/sys-workbench-audit-agent/deleteDoc")
    public boolean deleteDoc(@RequestParam("receiptNumber") String receiptNumber,@RequestParam("modelName") String modelName);

    /**
     * 根据物料编码查询详情(委外订单明细列表fegin调用)
     */
    @GetMapping("/accessories/getAccessoriesViewByMaterialCode")
    public AjaxResult getAccessoriesViewByMaterialCode(@RequestParam("materialCode") String materialCode);

    /**
     * 根据物料编码查询详情(委外订单明细列表fegin调用)
     * @param materialCode
     * @return
     */
    @GetMapping("/finished/getFinishViewByMaterialCode")
    public AjaxResult getFinishViewByMaterialCode(@RequestParam("materialCode") String materialCode);
}